package org.zht.dormpro.dorm.mapper;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.zht.dormpro.dorm.model.TbRepaire;

public interface TbRepaireMapper {
    @Delete({
        "delete from tb_repaire",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer id);

    @Insert({
        "insert into tb_repaire (id, dorm_id, ",
        "repairer_name, repair_name, ",
        "has_repaire, repaire_append, ",
        "repaire_status)",
        "values (#{id,jdbcType=INTEGER}, #{dormId,jdbcType=VARCHAR}, ",
        "#{repairerName,jdbcType=VARCHAR}, #{repairName,jdbcType=VARCHAR}, ",
        "#{hasRepaire,jdbcType=TINYINT}, #{repaireAppend,jdbcType=VARCHAR}, ",
        "#{repaireStatus,jdbcType=TINYINT})"
    })
    int insert(TbRepaire record);

    int insertSelective(TbRepaire record);

    @Select({
        "select",
        "id, dorm_id, repairer_name, repair_name, has_repaire, repaire_append, repaire_status",
        "from tb_repaire",
        "where id = #{id,jdbcType=INTEGER}"
    })
    @ResultMap("org.zht.dormpro.dorm.mapper.TbRepaireMapper.BaseResultMap")
    TbRepaire selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(TbRepaire record);

    @Update({
        "update tb_repaire",
        "set dorm_id = #{dormId,jdbcType=VARCHAR},",
          "repairer_name = #{repairerName,jdbcType=VARCHAR},",
          "repair_name = #{repairName,jdbcType=VARCHAR},",
          "has_repaire = #{hasRepaire,jdbcType=TINYINT},",
          "repaire_append = #{repaireAppend,jdbcType=VARCHAR},",
          "repaire_status = #{repaireStatus,jdbcType=TINYINT}",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(TbRepaire record);
}